home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Draw / CWindow_PostScore.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  5.8 KB  |  198 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CWindow_PostScore = ┬º┬ºnewclass(CWindow_PostScore,CWindow);
  6.    }
  7. }
  8.  
  9. package Local.Draw
  10. {
  11.    import Local.*;
  12.    import Local.External.*;
  13.    import Local.External.CMG.*;
  14.    import Local.Game.Level.*;
  15.    import fl.motion.easing.*;
  16.    import flash.display.*;
  17.    import flash.events.*;
  18.    import flash.filters.*;
  19.    import flash.geom.*;
  20.    
  21.    public class CWindow_PostScore extends CWindow
  22.    {
  23.       
  24.       public static const CANCELLED:String = "CANCELLED";
  25.       
  26.       public static const GAMEVERSION:String = "1.0";
  27.       
  28.       {
  29.          if(true)
  30.          {
  31.             CANCELLED = "CANCELLED";
  32.             GAMEVERSION = "1.0";
  33.          }
  34.       }
  35.       
  36.       private var mCancel:Boolean;
  37.       
  38.       public function CWindow_PostScore(param1:DisplayObject)
  39.       {
  40.          if(true)
  41.          {
  42.             super(new Window_PostScore(),param1,new Point(0,0));
  43.             if(true)
  44.             {
  45.                AddButton("cancel",new CScreenButton(mcDisplay.mcCancel,Button_Default)).addEventListener(CScreenButton.MOUSECLICK,e_CANCEL);
  46.                if(true)
  47.                {
  48.                   AddButton("ok",new CScreenButton(mcDisplay.mcOK,Button_Default)).addEventListener(CScreenButton.MOUSECLICK,e_OK);
  49.                   if(true)
  50.                   {
  51.                      mcDisplay.tbError.visible = false;
  52.                      if(true)
  53.                      {
  54.                         mcDisplay.tbResult.visible = false;
  55.                         if(true)
  56.                         {
  57.                            mcDisplay.mcOK.visible = false;
  58.                         }
  59.                         mcDisplay.mcProgress.visible = true;
  60.                      }
  61.                      mcDisplay.mcCancel.visible = true;
  62.                   }
  63.                   SetError("Unable to connect the server. Please check your connection and try again!",true);
  64.                }
  65.                SetSuccess("");
  66.             }
  67.             this.addEventListener(OPEN,e_WINDOW_OPENED);
  68.          }
  69.       }
  70.       
  71.       public static function ViewHiscoreTable() : void
  72.       {
  73.          CURL.ViewHiscore(CLevelData.mGameID);
  74.       }
  75.       
  76.       public function e_WINDOW_OPENED(param1:Event = null) : void
  77.       {
  78.          if(true)
  79.          {
  80.             SendScore();
  81.          }
  82.       }
  83.       
  84.       private function SetSuccess(param1:String) : void
  85.       {
  86.          mcDisplay.mcCancel.visible = false;
  87.          mcDisplay.mcProgress.visible = false;
  88.          mcDisplay.tbError.visible = false;
  89.          mcDisplay.tbResult.visible = true;
  90.          mcDisplay.tbResult.text = param1;
  91.          mcDisplay.mcOK.visible = true;
  92.          mCancel = false;
  93.       }
  94.       
  95.       private function e_SCORERESPONSE(param1:ServerResponseEvent) : void
  96.       {
  97.          var _loc2_:* = param1.returnCode;
  98.          if(ScoreSubmitter.RETURNCODE_WORKING === _loc2_)
  99.          {
  100.             ┬º┬ºpush(0);
  101.             if(true)
  102.             {
  103.             }
  104.          }
  105.          else if(ScoreSubmitter.RETURNCODE_SUCCESS === _loc2_)
  106.          {
  107.             ┬º┬ºpush(1);
  108.             if(false)
  109.             {
  110.                addr84:
  111.             }
  112.          }
  113.          else if(ScoreSubmitter.RETURNCODE_REJECTED === _loc2_)
  114.          {
  115.             ┬º┬ºpush(2);
  116.             if(false)
  117.             {
  118.                addr78:
  119.             }
  120.          }
  121.          else if(ScoreSubmitter.RETURNCODE_WRONGVERSION === _loc2_)
  122.          {
  123.             ┬º┬ºgoto(addr78);
  124.             ┬º┬ºpush(3);
  125.          }
  126.          else if(ScoreSubmitter.RETURNCODE_NETWORKERROR === _loc2_)
  127.          {
  128.             ┬º┬ºgoto(addr84);
  129.             ┬º┬ºpush(4);
  130.          }
  131.          else
  132.          {
  133.             ┬º┬ºpush(5);
  134.          }
  135.          switch(┬º┬ºpop())
  136.          {
  137.             case 0:
  138.                break;
  139.             case 1:
  140.                SetSuccess("YOUR SCORE HAS BEEN POSTED!!! \nThe score table will open shortly.");
  141.                ViewHiscoreTable();
  142.                break;
  143.             case 2:
  144.                SetError("The server rejected your score for reasons unknown!",false);
  145.                break;
  146.             case 3:
  147.                SetError("Wrong version of the game. Please check for the newest version at CrazyMonkeyGames.com",false);
  148.                break;
  149.             case 4:
  150.                SetError("Your score could not reach the server at this time. There was a network error",true);
  151.          }
  152.       }
  153.       
  154.       public function e_CANCEL(param1:Event = null) : void
  155.       {
  156.          if(true)
  157.          {
  158.             if(mCancel)
  159.             {
  160.                if(true)
  161.                {
  162.                   dispatchEvent(new Event(CANCELLED));
  163.                }
  164.             }
  165.             Close();
  166.          }
  167.       }
  168.       
  169.       public function SendScore() : void
  170.       {
  171.          var _loc1_:ScoreSubmitter = null;
  172.          ScoreSubmitter.gameId = CLevelData.mGameID;
  173.          ScoreSubmitter.gameVersion = GAMEVERSION;
  174.          ScoreSubmitter.gameValidationCode = CLevelData.mGameKey;
  175.          _loc1_ = new ScoreSubmitter();
  176.          _loc1_.addEventListener(ScoreSubmitter.SCORE_RESPONSE,e_SCORERESPONSE);
  177.          _loc1_.submitScore(CGlobal.GetField("playerid"),Number(Math.floor(CScreen_Debrief.mScore.mValue)));
  178.       }
  179.       
  180.       private function SetError(param1:String, param2:Boolean) : void
  181.       {
  182.          mcDisplay.mcCancel.visible = false;
  183.          mcDisplay.mcProgress.visible = false;
  184.          mcDisplay.tbResult.visible = false;
  185.          mcDisplay.tbError.visible = true;
  186.          mcDisplay.tbError.text = param1;
  187.          mcDisplay.mcOK.visible = true;
  188.          mCancel = param2;
  189.       }
  190.       
  191.       public function e_OK(param1:Event = null) : void
  192.       {
  193.          CMochiBot.SHZ_BO_HISCOREPOSTED();
  194.          Close();
  195.       }
  196.    }
  197. }
  198.